package de.karlNet.sambamanager.utils;

public class DNUtils {

	public static String getParentPath(String dnOfNewUser) {
		String parentPath = "";
		String[] components = dnOfNewUser.split(",");
	
		String concatElement = "";
		boolean skipFirst = true;
		for (String component : components) {
			if (skipFirst) {
				skipFirst = false;
				continue;
			}
			String[] subComponents = component.split("=");
			if (!subComponents[0].toLowerCase().equals("dc")) {
				parentPath = parentPath + concatElement + subComponents[0]
						+ "=" + subComponents[1];
			}
			concatElement = ",";
		}
		return parentPath;
	}

}
